﻿/*
	Date	: 10.10.11
	Author	: Lee
	Purpose	: Main Menu Furm
	
 */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GoldAir_DesktopApp
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();

            //setting the timmer for session timeout interval in miliseconds
            timer1.Enabled = true;
            //timer1.Interval = 9000; //9 secs
            //timer1.Interval = 60000; //60secs
            timer1.Interval = 600000; //600secs

        }

    
        private void exitToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox1 form = new AboutBox1();
            form.ShowDialog();
        }

        private void usersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmUser form = new frmUser();
            form.ShowDialog();
        }

        private void aircraftsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmAircraft form = new frmAircraft();
            form.ShowDialog();
        }

        private void routesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmRoute form = new frmRoute();
            form.ShowDialog();
        }

        private void flightsToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmFlight form = new frmFlight();
            form.ShowDialog();
        }

       
        private void btnUsers_Click(object sender, EventArgs e)
        {
            frmUser form = new frmUser();
            form.ShowDialog();
        }

        private void btnAircrafts_Click(object sender, EventArgs e)
        {
            frmAircraft form = new frmAircraft();
            form.ShowDialog();
        }

        private void btnRoutes_Click(object sender, EventArgs e)
        {
            frmRoute form = new frmRoute();
            form.ShowDialog();
        }

        private void btnFlights_Click(object sender, EventArgs e)
        {
            frmFlight form = new frmFlight();
            form.ShowDialog();
        }

       
        //Control session timeout related to the interval
        private void timer1_Tick(object sender, EventArgs e)
        {
            MessageBox.Show("Please login to continue","Session Timeout");
            
            timer1.Enabled = false;
            
                frmLogin flogin = new frmLogin();
                flogin.ShowDialog();

            //MessageBox.Show("back");
            timer1.Enabled = true;
        }

        private void checkInToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCheckin form = new frmCheckin();
            form.ShowDialog();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            frmCheckin form = new frmCheckin();
            form.ShowDialog();
        }

        private void cancellToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCancel form = new frmCancel();
            form.ShowDialog();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            frmCancel form = new frmCancel();
            form.ShowDialog();
        }

        private void reallocationsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmRealocate form = new frmRealocate();
            form.ShowDialog();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            frmRealocate form = new frmRealocate();
            form.ShowDialog();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

    }
}
